The VARIANCE function computes the statistical variance of an n-element vector.
Result = VARIANCE( X [, DIMENSION=value] [, /DOUBLE ] [, /NAN] )
Returns the floating-point or double-precision statistical variance of the input vector.
An n-element, floating-point or double-precision vector.
Set this keyword to a scalar indicating the dimension across which to calculate the variance. If this keyword is not present or is zero, then the variance is computed across all dimensions of the input array. If this keyword is present, then the variance is only calculated only across a single dimension. In this case the result is an array with one less dimension than the input.
If this keyword is set, VARIANCE performs its computations in double precision arithmetic and returns a double precision result. If this keyword is not set, the computations and result depend upon the type of the input data (integer and float data return float results, while double data returns double results).
Set this keyword to cause the routine to check for occurrences of the IEEE floating-point values NaN or Infinity in the input data. Elements with the value NaN or Infinity are treated as missing data.
; Define the n-element vector of sample data:
x = [1, 1, 1, 2, 5]
; Compute the variance:
result = VARIANCE(x)
PRINT, result
IDL prints:
3.00000
5.1 |
Introduced |
8.0 |
Added DIMENSION keyword |